package com.corex.listadapters;

import java.util.List;

import com.corex.vinayak.R;
import com.corex.vo.ClassDetails;

import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class AllClassesListAdpter extends ArrayAdapter<String>{
	private Context context;
	private String[] values;
	private List classDetails;
	
	public AllClassesListAdpter(Context context, int resource, List classDetails) {
		super(context, resource,classDetails);
		this.context = context;
		//this.values = values;
		this.classDetails = classDetails;
	}
	
	public AllClassesListAdpter(Context context, int resource, String[] values) {
		super(context, resource, values);
		this.context = context;
		this.values = values;
	}

	
	
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		LayoutInflater inflater = (LayoutInflater) context
		        .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		View rowView = inflater.inflate(R.layout.classes_layout, parent, false);
		ImageView classIcon = (ImageView) rowView.findViewById(R.id.classicon);
		ImageView classListGo = (ImageView) rowView.findViewById(R.id.loginsuccess_list_go);
		
		final Animation animBlink = AnimationUtils.loadAnimation(parent.getContext(), R.anim.blink);
		
		classListGo.setAnimation(animBlink);
		TextView className = (TextView) rowView.findViewById(R.id.ClassName);
		
		ClassDetails classDetailsVo = (ClassDetails) classDetails.get(position);
		className.setText(classDetailsVo.getClassName());
		classIcon.setImageResource(classDetailsVo.getIcon());
		
		return rowView;
	}

}
